import React, { Component } from "react";

import { Consumer } from "./App";

class Child2 extends Component {
  state = {};
  render() {
    return (
      <div>
        child2组件 - <br />
        <Consumer>
          {(value) => {
            return (
              <>
                <button onClick={value.minus}>-</button>
                <span>{value.count}</span>
                <button onClick={value.add}>+</button>
              </>
            );
          }}
        </Consumer>
      </div>
    );
  }
}

export default Child2;
